class Program { static void Main() { var actions = new List<Action>();
for (int i = 0; i < 3; i++) { actions.Add(() => Console.WriteLine(i)); }
foreach (var action in actions) action(); } }
Варианты ответа: A)
1 2
B)
3 3
C)
0 0
D)Ошибка компиляции
---
✅ Правильный ответ: B
Почему: Лямбда-функции захватывают переменную i по ссылке, а не её значение на каждой итерации. После завершения цикла i == 3, и все замыкания ссылаются на одно и то же i. Это классическая ловушка замыканий в C#.
class Program { static void Main() { var actions = new List<Action>();
for (int i = 0; i < 3; i++) { actions.Add(() => Console.WriteLine(i)); }
foreach (var action in actions) action(); } }
Варианты ответа: A)
1 2
B)
3 3
C)
0 0
D)Ошибка компиляции
---
✅ Правильный ответ: B
Почему: Лямбда-функции захватывают переменную i по ссылке, а не её значение на каждой итерации. После завершения цикла i == 3, и все замыкания ссылаются на одно и то же i. Это классическая ловушка замыканий в C#.
That growth environment will include rising inflation and interest rates. Those upward shifts naturally accompany healthy growth periods as the demand for resources, products and services rise. Importantly, the Federal Reserve has laid out the rationale for not interfering with that natural growth transition.It's not exactly a fad, but there is a widespread willingness to pay up for a growth story. Classic fundamental analysis takes a back seat. Even negative earnings are ignored. In fact, positive earnings seem to be a limiting measure, producing the question, "Is that all you've got?" The preference is a vision of untold riches when the exciting story plays out as expected.